﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using SmartProject.Data;

namespace SmartProject.BusinessObjects
{
    public class Priority : Reference
    {
        public Priority()
        {
            string[] priorities = { "When avaliable", "Normal", "High", "Important", "Critical" };
            base.Initialize("Priority", priorities);
        }

        /// <summary>
        /// Sets the label with the appropriate priority text based on the priority id.
        /// </summary>
        /// <param name="lblPriority">Label.</param>
        /// <param name="priorityId">Priority Id.</param>
        public void SetLabel(System.Web.UI.WebControls.Label lblPriority, string priorityId)
        {
            string priorityString = GetValue(Convert.ToInt32(priorityId));
            lblPriority.Text = priorityString;
            switch (priorityString)
            {
                case "Critical":
                    lblPriority.ForeColor = System.Drawing.Color.Red;
                    break;

                case "Important":
                    lblPriority.ForeColor = System.Drawing.Color.DarkOrange;
                    break;

                case "High":
                    lblPriority.ForeColor = System.Drawing.Color.Fuchsia;
                    break;

                case "Normal":
                    lblPriority.ForeColor = System.Drawing.Color.Green;
                    break;

                case "When avaliable":
                    lblPriority.ForeColor = System.Drawing.Color.Black;
                    break;
            }
        }
    }
}
